import 'package:enterprise_v6_app/app/core/values/colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// 自定义行标题
class CustomRowTitle extends StatelessWidget {
  const CustomRowTitle(
      {required this.title, this.content, this.contentColor = const Color(0xFF495061), this.contentWidget, this.isRequired = false, super.key});

  final String title;

  final String? content;

  final Color contentColor;

  final Widget? contentWidget;

  final bool isRequired;

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 8.w, right: 8.w, top: 8.w, bottom: 8.w),
      child: Row(
        children: [
          Visibility(
              visible: isRequired,
              child: Text(
                '*',
                style: TextStyle(
                  fontSize: 14.sp,
                  height: 1.2,
                  color: AppColors.meaning_color_danger,
                ),
              )),
          Text(
            title,
            style: TextStyle(
              color: const Color(0xFFA0A7B5),
              fontSize: 13.sp,
            ),
          ),
          Expanded(
              child: contentWidget ??
                  Text(
                    content ?? '',
                    textAlign: TextAlign.right,
                    style: TextStyle(
                      color: contentColor,
                      fontSize: 12.sp,
                    ),
                  )),
        ],
      ),
    );
  }
}
